ABC279 D - All Assign Point Add
提出
TLE
code: python
n = int(input())
a = list(map(int, input().split()))
q = int(input())
tmp = a
for query in queries:
sq = query.split(" ")
tmp[int(sq1)-1] += int(sq2) else:
解答
code: python
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))
q = int(input())
g = 0
base = 0
diff = defaultdict(int)
for query in queries:
sq = query.split(" ")
g += 1
diff[(g, int(sq1))] += int(sq2) else:
if g > 0:
print(base + diff[(g, int(sq1))]) else:
print(a[int(sq1) - 1] + diff[(g, int(sq1))]) メモ
提出
code: python
n = int(input())
a = list(map(int, input().split()))
q = int(input())
diff = 0
for query in queries:
if q1 == 2:
_, i, x = query
elif q1 == 3:
_, x = query
else:
_, x = query
# O(q*n)
# diff =